unit U_SevkIptalNedeniTan;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, cxCheckBox, ActnList, ADODB,
  StdCtrls, Buttons, cxGridLevel, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
  siComp;

type
  TfmSevkIptalNedeni = class(TForm)
    cxgrid1: TcxGrid;
    cxgrid1DBTableView1: TcxGridDBTableView;
    cxgrid1DBTableView1id: TcxGridDBColumn;
    cxgrid1DBTableView1NEDENI: TcxGridDBColumn;
    cxgrid1DBTableView1AKTIF: TcxGridDBColumn;
    cxgrid1Level1: TcxGridLevel;
    bKapat: TBitBtn;
    bSil: TBitBtn;
    adoListe: TADOQuery;
    DSLISTE: TDataSource;
    ActListe: TActionList;
    acSil: TAction;
    acKapat: TAction;
    adoSil: TADOQuery;
    adoTemp: TADOQuery;
    procedure bKapatClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure cxgrid1DBTableView1ColumnHeaderClick(
      Sender: TcxGridTableView; AColumn: TcxGridColumn);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmSevkIptalNedeni: TfmSevkIptalNedeni;

implementation

uses ana1;

{$R *.dfm}

procedure TfmSevkIptalNedeni.bKapatClick(Sender: TObject);
begin
  close;
end;

procedure TfmSevkIptalNedeni.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action:=Cafree;
  fmSevkIptalNedeni:=nil;
   
end;

procedure TfmSevkIptalNedeni.FormCreate(Sender: TObject);
begin
adoListe.close;
adoListe.sql.Text:=' Select * from CS_SEVKIYAT_IPTAL_NEDENI  order by ID ';
adoListe.open;
end;

procedure TfmSevkIptalNedeni.cxgrid1DBTableView1ColumnHeaderClick(
  Sender: TcxGridTableView; AColumn: TcxGridColumn);
begin
  If AColumn.SortOrder = soAscending Then
  Begin
    adoListe.sort := copy(AColumn.Name, 20, length(AColumn.Name) - 19) + ' DESC'
  End
  Else
  Begin
    adoListe.sort := copy(AColumn.Name, 20, length(AColumn.Name) - 19) + ' ASC';
  End;

  cxgrid1DBTableView1.OptionsBehavior.IncSearchItem := AColumn;
end;

end.